<%--
 Copyright (c) 2013, RMIT University, Australia.
 All rights reserved.
  
 This code is under the BSD license. See 'license.txt' for details.
 Project hosted at: https://code.google.com/p/climate-smart-seaports/
--%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page session="true" %>
<%@ page import= "org.springframework.web.servlet.tags.*" %>
<%@ page import="war.model.DataElementEngineeringModel" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<p>In <c:out value="${dataelement.weatherEvent.year}" />, the port experienced a disruptive <c:out value="${fn:toLowerCase(dataelement.weatherEvent.type)}" /> event. This event impacted the port ${dataelement.weatherEvent.direct == true ? 'directly' : 'indirectly through the impact on its supply chain'}. The impact was described as: <i>"<c:out value="${dataelement.weatherEvent.impact}" />"</i></p>

<p>The identified business consequences of these impacts, and their severity can be represented by the following graph:</p>

<div id="${dataelementsfilter}-engineeringModelChartTrigger"></div>
<script type="text/javascript">
$(function () {
	setTimeout(function(){
	var consequencesLabels = ["None", "Insignificant", "Moderate", "Major", "Extreme"];
	$('#${dataelementsfilter}-vulnerability-BarGraph${dataElementLoopIndex}').highcharts({   
	    chart: {
	        polar: true,
	        type: 'area'
	    },
	    title: {
	        text: 'Consequences Rating of ${dataelement.weatherEvent.type} in ${dataelement.weatherEvent.year}',
	    },
	    legend: {
	    	enabled: false
	    },
	    pane: {
	    	size: '70%'
	    },
	    xAxis: {
	        categories: ['Lost time injuries', 'Staff Attendance', 'Workcover costs', 
	     				'Maintenance costs', 'Deferment of CapEx', 'Insurance costs', 'Reputation impact', 
	    				'Environmental impact', 'Regulatory impact', 'Interruption to logistics', 
	    				'Boat movements', 'Dredging schedule'],
	        tickmarkPlacement: 'on',
	        lineWidth: 0
	    },
	    yAxis: {
	        gridLineInterpolation: 'polygon',
	        lineWidth: 0,
	        min: 0,
	        max: 4,
	        step: 0.5,
	        labels: {
	            enabled: false
	        }
	    },
	    tooltip: {
	    	shared: true,
	    	formatter: function() {
                var s = '<b>'+ this.x +'</b>';
                $.each(this.points, function(i, point) {
                    s += '<br/>' + point.series.name +': <span style="color:' + point.series.color + '">' + consequencesLabels[point.y] + '</span>';
                });
                return s;
            }
	    },
	    plotOptions: {
	    	series: {
	    		pointInterval: 1	
	    	}
	    },
	    series: [{
	        name: 'Consequence rating',
	        data: [<c:out value="${dataelement.weatherEvent.consequencesRating}" />],
	        pointPlacement: 'on',
	        color: '#CC0000',
	        fillColor: {
                linearGradient: [0, 0, 0, 300],
                stops: [
                    [0, 'rgb(69, 114, 167)'],
                    [1, 'rgba(2,0,0,0)']
                ]
            }
	    }]
	});
	}, 5);
});
</script>

<div id="${dataelementsfilter}-vulnerability-BarGraph${dataElementLoopIndex}" class="highcharts" style="width: 95%; margin: 10px auto">
</div>

<p>Other business consequences of these impacts are identified as: <i>"<c:out value="${dataelement.weatherEvent.consequencesOther}" />"</i></p>

<p>The response to this disruptive climate related event is describes as: </i>${dataelement.weatherEvent.responseAdequate == true ? 'adequate' : 'inadequate'}</i>. The following changes have been nominated as a result of the event: <i>"<c:out value="${dataelement.weatherEvent.changes}" />"</i></p>